﻿using System;
using System.Collections.Generic;

namespace Talented.Core.Model.Talents
{
	public class TalentConfiguration : ITalentConfiguration
	{
		#region constants
		public const string QualityValidationError = "Talent quality is not set";
		public const string CharacteristicsValidationError = "Characteristics and/or CharacteristicsGroth is invalid";
		public const string IdentifierValidationError = "Talent identifier is not valid";
		#endregion

		public Dictionary<CharacteristicEnum, double> Characteristics { get; set; }
		public Dictionary<CharacteristicEnum, double> CharacteristicsGroth { get; set; }
		public Guid TalentIdentifier { get; set; }
		public TalentQualityEnum Quality { get; set; }
		
		public bool Validate()
		{
			return 
				Characteristics.Count > 1 
				&& CharacteristicsGroth.Count > 1
				&& TalentIdentifier != Guid.Empty
				&& !Quality.Equals(TalentQualityEnum.NotSet);
		}
		
		public bool Validate(out List<string> validationList)
		{
			validationList = new List<string>();

			if (Characteristics.Count < 1 || CharacteristicsGroth.Count < 1)
				validationList.Add(CharacteristicsValidationError);

			if (TalentIdentifier == Guid.Empty)
				validationList.Add(IdentifierValidationError);

			if (Quality.Equals(TalentQualityEnum.NotSet))
				validationList.Add(QualityValidationError);

			return validationList.Count == 0;
		}
	}
}
